package com.huangliusong.desigin.pattern.creational.singleton;

/**双重检查c
 * @author huangliusong
 * @since 2018/10/10
 * {@link }
 */
public class LazyDoubleCheckSingleton {
    private volatile static LazyDoubleCheckSingleton lazyDoubleCheckSingleton=null;

    private LazyDoubleCheckSingleton() {

    }

    public static LazyDoubleCheckSingleton getInstance(){
        if ( lazyDoubleCheckSingleton==null){
            synchronized (LazyDoubleCheckSingleton.class){
                if (lazyDoubleCheckSingleton==null){
                    lazyDoubleCheckSingleton=new LazyDoubleCheckSingleton();
                    //1。分配内存

                    //2。初始化对象

                    //3。设置lazyDoubleCheckSingleton指向刚刚分配的内存地址
                }
            }
        }
        return lazyDoubleCheckSingleton;
    }
}
